<template>
	<view>
		<u-field v-model="formData.name" label="名称" placeholder="请填写名称"></u-field>
		<u-field v-model="formData.desc" label="描述" placeholder="请填写描述"></u-field>
		<u-upload :action="action" name="file" :form-data="formData"  @on-change="change" @on-remove="onRemove"></u-upload>
	</view>
</template>

<script>
	import {
		baseURL
	} from '@/config/app'
	export default {
		data() {
			return {
				action: `${baseURL}/common/xcxImageSourceUpload`,
				formData: {
					name: '',
					desc: ''
				},
				// fileList: [{
				// 	url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg',
				// }]
			};
		},
		methods: {
			onRemove(index, lists) {
				console.log('图片已被移除')
			},
			change(res, index, lists, name){
				if(res.statusCode == 200){
					this.$u.toast('上传成功')
				}
				console.log('服务器返回',res, index, lists, name)
			}
		}
	}
</script>

<style lang="scss">

</style>